import axios from "axios";


// 本身装饰器不支持自定义参数，通过返回一个函数，函数内再返回一个装饰器函数，实现自定义参数
const Get = (url: string) => {
    return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {
        const fn = descriptor.value;// 获取方法，对应就是getList方法
        axios.get(url).then(res => {
            console.log(res.data)
            fn(res.data, {
                status: '200'
            })
        })
            .catch((e) => {
                console.log(e)
                fn(e, {
                    status: '500'
                })
            })
    }
}


class Controller {

    @Get('https://api.apiopen.top/api/getHaoKanVideo?page=0&size=10')
    getList(data: any, status: any) {
        console.log('成功', data, status)

    }
}